<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c"%>
<%
	String path = request.getContextPath();
%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>融资机构账户信息修改</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>
<body>
	<form id="friBaseInfo_form">
		<div class="fieldset1 tabel_col tabel_col_1 clearFix">
			<!-- <div class="fieldset1 tabel_col tabel_col_s clearFix noBorder"> -->
			 <div class="caption">
				<span class="title">融资机构详情</span>
			</div>
			<div class="fieldBox col_33">
				<div class="label">融资机构名称：</div>
				<div class="field">
					<span name="fundRasInsNm" id="fundRasInsNm" >${friBaseInfo.fundRasInsNm}</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">机构缩写：</div>
				<div class="field">
					<span name="insAbb" id="insAbb" >${friBaseInfo.insAbb}</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">融资机构类型：</div>
				<div class="field">
					<span name="insTypeCdNm" id="insTypeCdNm" >${friBaseInfo.insTypeCdNm}</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">是否为ABS：</div>
				<div class="field">
					<span name="isAbs" id="isAbs" >${friBaseInfo.isAbs}</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">机构用途：</div>
				<div class="field">
					<span name="insUseCdNm" id="insUseCdNm" >${friBaseInfo.insUseCdNm}</span>
				</div>
			</div>
			<div class="fieldBox col_100" id="fileModify">
				<div class="label">资料</div>
				<div class="field">
					<jsp:include page="../../system/sysUlFilesRec/sysUlFileRecListDetail.jsp" flush="true">
						<jsp:param name="pkId" value="${friBaseInfo.id }" />
						<jsp:param name="tabNm" value="CST_BSC_INFO" />
					</jsp:include>
				</div>
			</div>
			<div class="fieldBox col_100">
				<div class="label">备注：</div>
				<div class="field">
					<span name="rem" id="rem" >${friBaseInfo.fundRasInsNm}</span>
				</div>
			</div>
			<!-- 融资机构账户信息  -->
		</div>
		</form>
		<form id="fribankAccInfo_form">
		 <div class="fieldset1 tabel_col tabel_col_1 clearFix">
			<div class="caption">
				<span class="title">账户信息</span>
			</div>
			<div class="fieldBox col_33">
				<div class="label">帐户用途：</div>
				<div class="field">
					<input type="text"   name="accTypCdNm" id="accTypCdNm"  class="ui-textbox" validate="{required:true}">
			        <input type="hidden" name="accTypCd" class="accTypCd"  id="accTypCd" data-ligerid="accTypCdNm" value="${bankAccInfo.accTypCd}">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">帐户类型：</div>
				<div class="field">
					<select name="pubVerPriCd" style="width:150px;" data-value=" ">
						<c:forEach items="${pubVerPriCdList }" var="kv">
							 <c:choose>
	                       		<c:when test="${kv.key == bankAccInfo.pubVerPriCd}">
	                        		<option value="${kv.key }" selected="selected">${kv.value }</option>
	                       		</c:when>
	                       		<c:otherwise>
									<option value="${kv.key }">${kv.value }</option>
	                       		</c:otherwise>
		                     </c:choose>
						</c:forEach>
					</select>
				<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">开户行号：</div>
				<div class="field">
					<input name="banAccNum" id="banAccNum" type="text" class="ui-textbox" value="${bankAccInfo.banAccNum}" validate="{required:true, maxlength:100}">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">开户行：</div>
				<div class="field">
					<input name="banAccNm" id="banAccNm" type="text" class="ui-textbox" value="${bankAccInfo.banAccNm}" validate="{required:true, maxlength:100}">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">户名：</div>
				<div class="field">
					<input name="accNm" id="accNm" type="text" class="ui-textbox" value="${bankAccInfo.accNm}" validate="{required:true, maxlength:100}">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_33">
				<div class="label">帐号：</div>
				<div class="field">
					<input name="accNum" id="accNum" type="text" class="ui-textbox" value="${bankAccInfo.accNum}" validate="{required:true, maxlength:100}">
					<span class="requiredSymbol">*</span>
				</div>
			</div>
			<div class="fieldBox col_100">
				<div class="label">帐号备注：</div>
				<div class="field">
					<input name="rem" id="rem" type="text" class="ui-textbox" size="200" value="${bankAccInfo.rem}" >
				</div>
			</div>
			<!-- 融资机构账户信息  -->
			<c:if test="${aflag=='001'}">
				<div class="caption">
					<span class="title">下一节点处理人</span>
				</div>
				<div class="fieldBox col_33">
					<div class="label">工号</div>
					<div class="field">
						<input id="jobNum"  name="jobNum"   type="text"   class="ui-textbox"  ligerui="width: 160" onkeyup="valiadateNum();" />
						<span id="" class="sq-button-hasicon" onclick="getSysUsr();"><i class="sqBtnIco_4"></i>查找</span>
						<input  id="nextAssigneeId"  name="nextAssigneeId" value="${bankAccInfo.nextAssigneeId}"  type="hidden"   class="ui-textbox"  ligerui="width: 160" />
					</div>
				</div>
				<div class="fieldBox col_33">
					<div class="label">处理人（工号）</div>
					<div class="field">
						<input id="idCard"  value="${userVO.usrNm}" type="text"   class="ui-textbox"  ligerui="width: 160"  disabled="disabled"  />
					</div>
				</div>
				<div class="fieldBox col_33">
					<div class="label">处理人（姓名）</div>
					<div class="field">
						<input id="recipient"  value="${userVO.refRlNm}" type="text"   class="ui-textbox"  ligerui="width: 160"   disabled="disabled"  />
					</div>
				</div>
			</c:if>
			<!-- hide data -->
			<div class="fieldBox col_100" style="display:none;">
				<div class="field">
					<input name="dataId" id="dataId" type="text" class="ui-textbox" value="${bankAccInfo.id}"><!-- 账户id -->
					<input  id="aflag" type="text" class="ui-textbox" value="${aflag}"><!-- 账户id -->
				</div>
			</div>
		</div>
		<div class="btnsBox">
			<span id="fri_bank_acc_info_btn_id" class="sq-button sq-button-round" onclick="save();">保存 </span>
		</div>
	</form>
	<script type="text/javascript">
		$(function() {
			//账户用途
			$("#accTypCdNm").ligerComboBox({ isShowCheckBox: true, isMultiSelect: true,
	     	   	 data: [ { name: 'key', width: 100}, 
	     	   	         { name: 'value', width: 120}
	     	   	 ],
		          url:'<%=path%>/rfbase/fribaseinfo/getAccTypCd.do',
		          ajaxType :'GET',
		          slide: false,
		          valueField: 'key', textField: 'value',
		          valueFieldID: 'accTypCd'
		     });
			//格式
		   $("#friBaseInfo_form").ligerForm({
             validate: true
        	});
		   $("#fribankAccInfo_form").ligerForm({
	             validate: true
	       });
		});
		//查找收件人 
		function getSysUsr(){
			if($.trim($("#jobNum").val()) == ""){
				$.ligerDialog.SQalert({content: "请填写工号",SQ_type: "warning"});
				return;
			}
			 $.ajax({
				type: 'get',
				dataType:'json',
				url: '<%=path%>/archive/arcTransferMain/getSysUsr.do?jobNum='+$("#jobNum").val(),
				success:function(msg){
					//console.log(msg);
					 if(msg.success == 1){
						 if(msg.data){
							 $("#nextAssigneeId").val(msg.data.id);
							 $('#idCard').val(msg.data.usrNm);
							 $('#recipient').val(msg.data.refRlNm);
							 alert("查找成功!");
						 }else{
							 $.ligerDialog.SQalert({content:"没有查询到对应人员", SQ_type: "warning"});
							 //$("#nextAssigneeId").val("");
						 }
					 }else{
						 $.ligerDialog.SQalert({content:msg.info, SQ_type: "error"});
					 }
				}
			}); 
		}
		//保存 融资机构账户信息
		function save(){
			// 1 校验
			if($.trim($("#dataId").val()) == ""){
				$.ligerDialog.SQalert({content: "业务主键不存在!",SQ_type: "warning"});
				return;
			}
			var ligerForm = liger.get("fribankAccInfo_form");
			
			if (!ligerForm.valid()) {
		    	$.ligerDialog.SQalert({content:LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning",SQ_showButtons: true});
	            return false ; 
	        }
			//2  封装数据
			var data = ligerForm.getData();
			data['accTypCd']=$('#accTypCd').val();
			
			var aflag=$('#aflag').val();
			if(aflag=='001'){
				data['nextAssigneeId']=$('#nextAssigneeId').val();	
			}
			var wait_dialog = null;
			$.ajax({
				type: 'post',
				dataType: 'json',
				data:data ,
				url: '<%=path%>/rfbase/fribaseinfo/modifyBankAccInfo.do?',
				beforeSend: function(){
					wait_dialog=$.ligerDialog.SQalert({content: LogUtils.LOG_CMM_DATA_LOADING ,SQ_type: "waitting"});
				},success:function(msg){
					wait_dialog.close();
					$.ligerDialog.SQalert({content: msg.info,SQ_type: "success"});
				},error:function (XMLHttpRequest, textStatus, errorThrown) { 
					wait_dialog.close();
					$.ligerDialog.SQalert({content: "网络错误，请稍后重试",SQ_type: "error"});
				} 
			});
		}
		function valiadateNum(){//校验用户输入的信息
			var jobNum=$.trim($("#jobNum").val());//工号
			if(jobNum!=''){
				var tel = /^[\u4e00-\u9fa5]+$/;//汉字正则
				if(tel.test(jobNum)){
					$.ligerDialog.SQalert({content: "请填写工号",SQ_type: "warning"});
					$("#jobNum").val("");
				}
			}
		}
	</script>

</body>
</html>